#!/usr/env/bin python
# -*- coding: utf-8 -*-

# @Time    : 2020-10-29 8:56 上午
# @Author  : yangdy
# @File    : 2020-10-28.1207.独一无二的出现次数
# @Software: PyCharmCE
from tools.my_methods import *


class Solution:
    def uniqueOccurrences(self, arr: List[int]) -> bool:
        arr.sort()
        c, p = [], 0
        for i in range(1, len(arr)):
            if arr[i] != arr[i-1]:
                c.append(i-p)
                p = i
        c.append(len(arr)-p)
        c.sort()
        for i in range(1, len(c)):
            if c[i] == c[i-1]:
                return False
        return True
